import request from '@/utils/request'
// --------  跟单 --------

let BASE_ADDRESS = '/work/documentary'

// 查询跟单对应的订单  /work/documentary/listOrder
export const getDocumentaryListOrderApi = (data) =>{
    // 有订单编号
    if(data.orderNo){
        return request({
            url: `${BASE_ADDRESS}/listOrder?pageNum=${data.pageNum}&pageSize=${data.pageSize}&sort=${data.sort}&order=${data.order}&followId=${data.followId ? data.followId : ""}&orderNo=${data.orderNo ? data.orderNo : ""}`,
            method: 'get',
        })
    }else if(data.title){
        // 有标题
        return request({
            url: `${BASE_ADDRESS}/listOrder?pageNum=${data.pageNum}&pageSize=${data.pageSize}&sort=${data.sort}&order=${data.order}&followId=${data.followId ? data.followId : ""}&title=${data.title ? data.title : ""}`,
            method: 'get',
        })
    }else if(data.expertId){
        // 有专家id
        return request({
            url: `${BASE_ADDRESS}/listOrder?pageNum=${data.pageNum}&pageSize=${data.pageSize}&sort=${data.sort}&order=${data.order}&followId=${data.followId ? data.followId : ""}&expertId=${data.expertId ? data.expertId : ""}`,
            method: 'get',
        })
    }else if(data.status){
        // 有订单状态
        return request({
            url: `${BASE_ADDRESS}/listOrder?pageNum=${data.pageNum}&pageSize=${data.pageSize}&sort=${data.sort}&order=${data.order}&followId=${data.followId ? data.followId : ""}&status=${data.status ? data.status : ""}`,
            method: 'get',
        })
    }else{
        return request({
            url: `${BASE_ADDRESS}/listOrder?pageNum=${data.pageNum}&pageSize=${data.pageSize}&sort=${data.sort}&order=${data.order}&followId=${data.followId ? data.followId : ""}`,
            method: 'get',
        })
    }
}

// 查询专家列表  /work/expert/list
export const getExpertListApi = (params) =>{
    return request({
        url:`/work/expert/list`,
        method:'get',
        params
    })
} 

// 咨询订单结束订单的接口
export const overClosOrderApi = (data) =>{
    return request({
        url:`/financial/order/closOrder`,
        method:'put',
        data
    })
}

// 项目订单结束订单的接口
export const overProjectFinishApi = (orderId) =>{
    return request({
        url:`/doc/project/finish/${orderId}`,
        method:'put',
    })
}

// 重新分配专家
export const updateOrderExpertApi = (id,expertId,type) =>{
    return request({
        url:`/financial/order/updateOrderExpert/${id}/${expertId}/${type}`,
        method:'put',
    })
}

// 查询项目可分配专家列表  /assess/projectRule/selectExpertByCity
export const getProjectRuleSelectExpertByCityApi = (esId) =>{
    return request({
        url:`/assess/projectRule/selectExpertByCity?esId=${esId}`,
        method:'get',
    })
}